<template>
  <div>
    <el-button>{{ node.data.text }} </el-button>
  </div>
</template>

<script>
export default {
  name: 'Count',
  inject: ['getGraph', 'getNode'],
  data() {
    return {

    }
  },
  computed: {
    node() {
      return this.getNode()
    }
  },
  mounted() {
    // const self = this
    // const node = this.getNode()
    // console.log(node.data, '===node===')
    // 监听数据改变事件
    // node.on('change:data', ({ current }) => {
    //   self.num = current.num
    // })
  },
  methods: {
    add() {
      const node = this.getNode();
      const { num } = node.getData()
      node.setData({
        num: num + 1,
      });
    },
  },
};
</script>
